You are here: Building the Model: General Elements > Pre-defined Tank Subroutines > Tank_SetLevel > Description
Instantly sets the level of a tank to a specified quantity. If the quantity is negative or larger than the tank capacity, an error occurs. The tank state sets to Tank_Blocked if you set the tank level to the tank capacity and to Tank_Idle if you set the tank level to 0. Otherwise, the state remains unchanged.
Use Tank_SetLevel when you want to initialize a tank to a specific level.
Components
<Tank ID>
The tank name or location index number.
<Quantity>
The level at which to set the tank (number of gallons, pounds). To completely fill the tank, enter Tank_Cap(<Tank Name>).
Example
When you begin a simulation, you wish to set the initial level of a supply tank, TankX, to 10,000 gallons. To model this, enter the following statement in the initialization logic for the model.
Tank_SetLevel(TankX, 10000)